home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.PropertyPage ppButtons
- Caption = "General"
- ClientHeight = 2685
- ClientLeft = 0
- ClientTop = 0
- ClientWidth = 5625
- PaletteMode = 0 'Halftone
- ScaleHeight = 2685
- ScaleWidth = 5625
- Begin VB.PictureBox imgButton
- Height = 690
- Left = 3735
- ScaleHeight = 630
- ScaleWidth = 630
- TabIndex = 18
- Top = 1440
- Width = 690
- End
- Begin VB.CheckBox chkDropDown
- Caption = "Drop-down Button"
- Height = 240
- Left = 1350
- TabIndex = 17
- Top = 2160
- Width = 1680
- End
- Begin VB.CheckBox chkVisible
- Caption = "Visible"
- Height = 240
- Left = 1350
- TabIndex = 10
- Top = 1890
- Width = 870
- End
- Begin VB.CheckBox chkEnabled
- Caption = "Enabled"
- Height = 240
- Left = 2250
- TabIndex = 9
- Top = 1890
- Width = 915
- End
- Begin VB.TextBox txtIndex
- BackColor = &H8000000F&
- Height = 285
- Left = 1350
- Locked = -1 'True
- TabIndex = 8
- TabStop = 0 'False
- Top = 225
- Width = 690
- End
- Begin VB.TextBox txtCaption
- Height = 285
- Left = 1350
- TabIndex = 7
- Top = 540
- Width = 1770
- End
- Begin VB.TextBox txtTag
- Height = 285
- Left = 1350
- TabIndex = 6
- Top = 1215
- Width = 1770
- End
- Begin VB.TextBox txtToolTip
- Height = 285
- Left = 1350
- TabIndex = 5
- Top = 1530
- Width = 1770
- End
- Begin VB.ComboBox cboStyle
- Height = 315
- ItemData = "ppButtons.pgx":0000
- Left = 1350
- List = "ppButtons.pgx":0013
- Style = 2 'Dropdown List
- TabIndex = 4
- Top = 855
- Width = 1770
- End
- Begin VB.HScrollBar hsbButton
- Height = 285
- Left = 2115
- TabIndex = 3
- Top = 225
- Width = 510
- End
- Begin VB.CommandButton cmdImage
- Height = 330
- Left = 3375
- Picture = "ppButtons.pgx":0060
- Style = 1 'Graphical
- TabIndex = 2
- ToolTipText = "Load Image"
- Top = 1440
- UseMaskColor = -1 'True
- Width = 330
- End
- Begin VB.CommandButton cmdButton
- Caption = "I&nsert Button"
- Height = 330
- Index = 0
- Left = 4140
- TabIndex = 0
- Top = 180
- Width = 1320
- End
- Begin VB.CommandButton cmdButton
- Caption = "&Remove Button"
- Enabled = 0 'False
- Height = 330
- Index = 1
- Left = 4140
- TabIndex = 1
- Top = 540
- Width = 1320
- End
- Begin VB.Label Label1
- Caption = "Index:"
- Height = 195
- Index = 0
- Left = 225
- TabIndex = 16
- Top = 270
- Width = 825
- End
- Begin VB.Label Label1
- Caption = "Caption:"
- Height = 195
- Index = 1
- Left = 225
- TabIndex = 15
- Top = 585
- Width = 825
- End
- Begin VB.Label Label1
- Caption = "Style:"
- Height = 195
- Index = 3
- Left = 225
- TabIndex = 14
- Top = 900
- Width = 825
- End
- Begin VB.Label Label1
- Caption = "Tag:"
- Height = 195
- Index = 4
- Left = 225
- TabIndex = 13
- Top = 1260
- Width = 825
- End
- Begin VB.Label Label1
- Caption = "ToolTip Text:"
- Height = 195
- Index = 5
- Left = 225
- TabIndex = 12
- Top = 1575
- Width = 1095
- End
- Begin VB.Label Label1
- Caption = "Image:"
- Height = 195
- Index = 6
- Left = 3735
- TabIndex = 11
- Top = 1170
- Width = 825
- End
- End
- Attribute VB_Name = "ppButtons"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = True
- Private bFirst As Boolean
-
- Private Sub cboStyle_Click()
- Changed = True
- End Sub
-
- Private Sub chkDropDown_Click()
- Changed = True
- End Sub
-
- Private Sub chkEnabled_Click()
- Changed = True
- End Sub
-
- Private Sub chkVisible_Click()
- Changed = True
- End Sub
-
- Private Sub cmdButton_Click(Index As Integer)
- Select Case Index
- Case 0 'insert button
- If SelectedControls(0).Count = 0 Then EnableAll: cmdButton(1).Enabled = True
- SelectedControls(0).AddItem
- txtIndex = SelectedControls(0).Count
- txtCaption = ""
- cboStyle.ListIndex = 0
- txtToolTip = ""
- txtTag = ""
- chkVisible.value = 1
- chkEnabled.value = 1
- chkDropDown.value = 0
- Set imgButton.Picture = Nothing
- SaveItem SelectedControls(0).Count
- hsbButton.Min = 1
- hsbButton.Max = SelectedControls(0).Count
- hsbButton.value = SelectedControls(0).Count
-
- Case 1 'remove button
- If SelectedControls(0).Count > 0 Then
- SelectedControls(0).Remove hsbButton.value
- If SelectedControls(0).Count > 0 Then
- hsbButton.Max = SelectedControls(0).Count
- hsbButton.value = 1
- Else
- hsbButton.Max = 1
- hsbButton.value = 1
- cmdButton(1).Enabled = False
- txtIndex = "1"
- txtCaption = ""
- txtToolTip = ""
- txtTag = ""
- chkVisible.value = 0
- chkEnabled.value = 0
- chkDropDown.value = 0
- cboStyle.ListIndex = 0
- DisableAll
- End If
- SelectedControls(0).RedrawButtons
- Else
- Beep
- MsgBox "No buttons to remove", vbOKOnly, "User Error"
- End If
- End Select
- End Sub
-
- Private Sub cmdImage_Click()
- Dim Common As New clsCommonDialog
- Common.DialogTitle = "Load Picture"
- Common.InitDir = App.Path
- Common.Filter = "All Picture Files|*.bmp;*.ico;*.rle;*.wmf;*.emf;*.gif;*.jpg"
- Common.ShowOpen
- If Not Common.Cancelled Then
- imgButton.Picture = LoadPicture(Common.FileName)
- Else
- Set imgButton.Picture = Nothing
- End If
- Changed = True
- End Sub
-
- Private Sub hsbButton_Change()
- If SelectedControls(0).Count > 0 Then
- txtIndex = hsbButton.value
- txtCaption = SelectedControls(0).Item(hsbButton.value).Caption
- txtToolTip = SelectedControls(0).Item(hsbButton.value).ToolTipText
- txtTag = SelectedControls(0).Item(hsbButton.value).Tag
- cboStyle.ListIndex = SelectedControls(0).Item(hsbButton.value).Style
- Set imgButton.Picture = IIf(SelectedControls(0).Item(hsbButton.value).Bitmap Is Nothing, Nothing, SelectedControls(0).Item(hsbButton.value).Bitmap)
- chkVisible = SelectedControls(0).Item(hsbButton.value).Visible
- chkEnabled = SelectedControls(0).Item(hsbButton.value).Enabled
- chkDropDown = SelectedControls(0).Item(hsbButton.value).DropDown
- End If
- Changed = False
- End Sub
-
- Private Sub hsbButton_GotFocus()
- If txtCaption.Enabled Then txtCaption.SetFocus
- End Sub
-
- Private Sub PropertyPage_ApplyChanges()
- SaveItem hsbButton.value
- End Sub
-
- Public Sub SaveItem(Index As Integer)
- If SelectedControls(0).Count > 0 Then
- SelectedControls(0).Item(Index).Caption = txtCaption
- SelectedControls(0).Item(Index).ToolTipText = txtToolTip
- SelectedControls(0).Item(Index).Tag = txtTag
- SelectedControls(0).Item(Index).Style = cboStyle.ListIndex
- Set SelectedControls(0).Item(Index).Bitmap = IIf(imgButton.Picture Is Nothing, Nothing, imgButton.Picture)
- SelectedControls(0).Item(Index).Visible = chkVisible
- SelectedControls(0).Item(Index).Enabled = chkEnabled
- SelectedControls(0).Item(Index).DropDown = chkDropDown
- SelectedControls(0).RedrawButtons
- End If
- End Sub
-
- Private Sub PropertyPage_Initialize()
- bFirst = True 'this is used to preven SelectionChanged code from firing more than once
- End Sub
-
- Private Sub PropertyPage_SelectionChanged()
- If bFirst Then
- bFirst = False
- If SelectedControls(0).Count > 0 Then
- EnableAll
- cmdButton(1).Enabled = True
- hsbButton.Min = 1
- hsbButton.Max = SelectedControls(0).Count
- hsbButton.value = 1
- Else
- hsbButton.Min = 1
- hsbButton.Max = 1
- hsbButton.value = 1
- DisableAll
- cmdButton(1).Enabled = False
- End If
- End If
- End Sub
-
- Private Sub EnableAll()
- hsbButton.Enabled = True
- cmdImage.Enabled = True
- chkVisible.Enabled = True
- chkEnabled.Enabled = True
- chkDropDown.Enabled = True
-
- txtCaption.Enabled = True
- txtCaption.BackColor = vbWindowBackground
- txtTag.Enabled = True
- txtTag.BackColor = vbWindowBackground
- txtToolTip.Enabled = True
- txtToolTip.BackColor = vbWindowBackground
- cboStyle.Enabled = True
- cboStyle.BackColor = vbWindowBackground
- End Sub
-
- Private Sub DisableAll()
- hsbButton.Enabled = False
- cmdImage.Enabled = False
- chkVisible.Enabled = False
- chkEnabled.Enabled = False
- chkDropDown.Enabled = False
-
- txtCaption.Enabled = False
- txtCaption.BackColor = vbButtonFace
- txtTag.Enabled = False
- txtTag.BackColor = vbButtonFace
- txtToolTip.Enabled = False
- txtToolTip.BackColor = vbButtonFace
- cboStyle.Enabled = False
- cboStyle.BackColor = vbButtonFace
- End Sub
-
- Private Sub txtCaption_Change()
- Changed = True
- End Sub
-
- Private Sub txtTag_Change()
- Changed = True
- End Sub
-
- Private Sub txtToolTip_Change()
- Changed = True
- End Sub
-